package com.stylefeng.guns.core.exception;

/**
 * Guns异常枚举
 *
 * @author fengshuonan
 * @Date 2017/12/28 下午10:33
 */
public enum GunsExceptionEnum implements ServiceExceptionEnum {

    /**
     * 其他
     */
    WRITE_ERROR(500, "渲染界面错误"),
    SUCCESS(0, "success"),

    NOT_LOGIN(1, "用户没有登录"),

    INVALIDATE_KAPTCHA(2, "验证码错误"),

    PHONE_NUMBER_VALIDATE(3, "手机号格式不正确"),

    DICT_NULL(4, "数据字典不存在"),

    USERNAME_AND_PASSWORD_ERROR(2, "用户名或密码错误"),

    /**
     * 文件上传
     */
    FILE_READING_ERROR(400, "FILE_READING_ERROR!"),

    FILE_NOT_FOUND(400, "FILE_NOT_FOUND!"),

    /**
     * 文件格式不正确
     */
    FILE_FORMAT_NOT_FOUND(10, "FILE_FORMAT_NOT_FOUND!"),

    /**
     * http请求获取结果失败
     */
    HTTPASYNCUTIL_GETRESPONSE_ERROR(1000, "HttpAsyncUtil.GetResponse.Error"),

    /**
     * http请求编码失败
     */
    HTTPASYNCUTIL_UNSUPPORTEDENCODING(1001, "HttpAsyncUtil.UnsupportedEncoding"),

    /**
     * 错误的请求
     */
    REQUEST_NULL(400,"请求有错误"),

    SERVER_ERROR(500,"服务器异常"),

    /**
     * base64编解码异常
     */
    BASE64_CODER_ERROR(10,"Base64Coder.Encode.Error");

    GunsExceptionEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private Integer code;

    private String message;

    @Override
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
